#include <sys/stat.h>
#include <fcntl.h>
#include "stdio.h"
#include <unistd.h>
int main()
{
    char Rbuf[40];//读取缓冲区
    char Wbuf[40]="afsfs";//要写入的buf
    int fb = open("1.txt", O_RDWR);//可读写打开
    if(fb == -1)
    {
        perror("error");
    }

    int Rnum = read(fb, Rbuf ,40);
    printf("Rnum = %d\n",Rnum);//读取的个数
    printf("buf is:%s\n",Rbuf);//打印读取到的内容

    
    int Wnum = write(fb, Wbuf, 40);
    printf("Wnum = %d\n",Wnum);//写入的个数

    close(fb);//关闭文件
}

